import Vue from 'vue'
import Router from 'vue-router'
// 导入刚才编写的组件
import AppIndex from '@/components/home/AppIndex'
import Login from '@/components/Login'
import Home from '../components/home'
import TeacherIndex from '../components/teacher/TeacherIndex'
import Course from '../components/views/course'
import Admin from '../components/views/admin'
import Information from '../components/views/information'

Vue.use(Router)

export default new Router({
  //mode: 'history',
  routes: [
    {
      path: '/home',
      name: 'Home',
      component: Home,
      // home页面并不需要被访问
      redirect: '/index',
      children: [
        {
          path: '/index',
          name: 'AppIndex',
          component: AppIndex,
          meta: {
            requireAuth: true
          }
        },
        {
          path: '/course',
          name: 'course',
          component: Course,
        },
        {
          path: '/information',
          name: 'information',
          component: Information,
        },
        {
          path: '/admin',
          name: 'admin',
          component: Admin,
        },
    {
      path: '/teacher',
      name: 'teacher',
      component: TeacherIndex,
      meta: {
        requireAuth: true
      }
    }
  ]
},
    {
      path: '/login',
      name: 'Login',
      component: Login
    }
  ]
})